package com.wc.alorithm_luogu.P1425;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/17 19:28
 * @description https://www.luogu.com.cn/problem/P1425
 * 小鱼的游泳时间
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int startH = sc.nextInt();
        int startM = sc.nextInt();

        int endH = sc.nextInt();
        int endM = sc.nextInt();

        int time = endH * 60 + endM - startH * 60 - startM;

        System.out.println(time / 60 + " " + (time - time / 60 * 60));
    }
}
